﻿/***********************************/
/***********Coding by C@T***********/
/***********************************/
using System;
using System.Collections.Generic;
using System.Web.UI;
using DevExpress.Web.ASPxGridView;
using DevExpress.Web.ASPxEditors;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void gvwWorks_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {
        if (e.NewValues["StaffID"] == null)
        {
            AddError(e.Errors, gvwWorks.Columns["StaffID"], "Staff not be null");
        }

        if (e.NewValues["ClassID"] == null)
        {
            AddError(e.Errors, gvwWorks.Columns["ClassID"], "Class not be null");
        }

        if (e.NewValues["CourseID"] == null)
        {
            AddError(e.Errors, gvwWorks.Columns["CourseID"], "Course not be null");
        }
   }

    private void AddError(Dictionary<GridViewColumn, string> errors, GridViewColumn column, string errorText)
    {
 	    if (errors.ContainsKey(column)) return;
        errors[column] = errorText;
    }
    
}